<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of write_FVCOM_z0</title>
  <meta name="keywords" content="write_FVCOM_z0">
  <meta name="description" content="Dump spatially-variable bottom roughness (z0) to FVCOM forcing file">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html v1.5 &copy; 2003-2005 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../m2html.css">
</head>
<body>
<a name="_top"></a>
<div><a href="../index.html">Home</a> &gt;  <a href="index.html">fvcom_prepro</a> &gt; write_FVCOM_z0.m</div>

<!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png">&nbsp;Master index</a></td>
<td align="right"><a href="index.html">Index for fvcom_prepro&nbsp;<img alt=">" border="0" src="../right.png"></a></td></tr></table>-->

<h1>write_FVCOM_z0
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>Dump spatially-variable bottom roughness (z0) to FVCOM forcing file</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>function write_FVCOM_z0(z0,filename,mytitle) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre class="comment"> Dump spatially-variable bottom roughness (z0) to FVCOM forcing file

 function write_FVCOM_z0(z0,filename,mytitle)

 DESCRIPTION:
    Generate a NetCDF file containing spatially variable z0 for FVCOM 

 INPUT 
   z0        = user defined roughness field (m) 
               roughness is defined on the elements
   filename  = filename to dump to
   mytitle   = title of the case (set as global attribute) 

 OUTPUT:
    NetCDF file: filename

 EXAMPLE USAGE
    write_FVCOM_z0(z0field, 'tst_z0.nc', 'z0 tst domain')

 Author(s):  
    Geoff Cowles (University of Massachusetts Dartmouth)

 Revision history
   
==============================================================================</pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
This function is called by:
<ul style="list-style-image:url(../matlabicon.gif)">
<li><a href="example.html" class="code" title="">example</a>	example demonstrating reading in a 2DM file and constructing a model</li></ul>
<!-- crossreference -->



<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function write_FVCOM_z0(z0,filename,mytitle) </a>
0002 
0003 <span class="comment">% Dump spatially-variable bottom roughness (z0) to FVCOM forcing file</span>
0004 <span class="comment">%</span>
0005 <span class="comment">% function write_FVCOM_z0(z0,filename,mytitle)</span>
0006 <span class="comment">%</span>
0007 <span class="comment">% DESCRIPTION:</span>
0008 <span class="comment">%    Generate a NetCDF file containing spatially variable z0 for FVCOM</span>
0009 <span class="comment">%</span>
0010 <span class="comment">% INPUT</span>
0011 <span class="comment">%   z0        = user defined roughness field (m)</span>
0012 <span class="comment">%               roughness is defined on the elements</span>
0013 <span class="comment">%   filename  = filename to dump to</span>
0014 <span class="comment">%   mytitle   = title of the case (set as global attribute)</span>
0015 <span class="comment">%</span>
0016 <span class="comment">% OUTPUT:</span>
0017 <span class="comment">%    NetCDF file: filename</span>
0018 <span class="comment">%</span>
0019 <span class="comment">% EXAMPLE USAGE</span>
0020 <span class="comment">%    write_FVCOM_z0(z0field, 'tst_z0.nc', 'z0 tst domain')</span>
0021 <span class="comment">%</span>
0022 <span class="comment">% Author(s):</span>
0023 <span class="comment">%    Geoff Cowles (University of Massachusetts Dartmouth)</span>
0024 <span class="comment">%</span>
0025 <span class="comment">% Revision history</span>
0026 <span class="comment">%</span>
0027 <span class="comment">%==============================================================================</span>
0028 warning off
0029 subname = <span class="string">'write_FVCOM_z0'</span>;
0030 <span class="keyword">global</span> ftbverbose;
0031 <span class="keyword">if</span>(ftbverbose);
0032   fprintf(<span class="string">'\n'</span>); fprintf([<span class="string">'begin : '</span> subname <span class="string">'\n'</span>]);
0033 <span class="keyword">end</span>;
0034 
0035 <span class="comment">%------------------------------------------------------------------------------</span>
0036 <span class="comment">% Parse input arguments</span>
0037 <span class="comment">%------------------------------------------------------------------------------</span>
0038 <span class="keyword">if</span>(~exist(<span class="string">'z0'</span>))
0039     error(<span class="string">'incorrect usage of gen_z0_file, must provide z0 field'</span>)
0040 <span class="keyword">end</span>;
0041 <span class="keyword">if</span>(~exist(<span class="string">'filename'</span>))
0042     error(<span class="string">'incorrect usage of gen_z0_file, must provide filename'</span>)
0043 <span class="keyword">end</span>;
0044 <span class="keyword">if</span>(~exist(<span class="string">'title'</span>))
0045     error(<span class="string">'incorrect usage of gen_z0_file, must provide title field'</span>)
0046 <span class="keyword">end</span>;
0047 
0048 <span class="comment">% check dimensions</span>
0049 nElems = prod(size(z0));
0050 <span class="keyword">if</span>(nElems == 0)
0051     error(<span class="string">'dimension of z0 is 0, something is wrong '</span>)
0052 <span class="keyword">end</span>;
0053 
0054 <span class="comment">%------------------------------------------------------------------------------</span>
0055 <span class="comment">% Dump to z0 NetCDF file</span>
0056 <span class="comment">%------------------------------------------------------------------------------</span>
0057 <span class="keyword">if</span>(ftbverbose);
0058   fprintf(<span class="string">'Dumping to z0 NetCDF file: \n'</span>,filename);
0059   fprintf(<span class="string">'Size of z0 array: \n'</span>,nElems);
0060 <span class="keyword">end</span>;
0061 nc = netcdf(filename,<span class="string">'clobber'</span>);
0062 nc.title = mytitle;
0063 nc(<span class="string">'nele'</span>) = prod(size(z0));
0064 nc{<span class="string">'z0b'</span>}  = ncfloat(<span class="string">'nele'</span>);
0065 nc{<span class="string">'z0b'</span>}.long_name = <span class="string">'bottom roughness'</span>;
0066 nc{<span class="string">'z0b'</span>}.units = <span class="string">'m'</span>;
0067 nc{<span class="string">'z0b'</span>}(1:nElems) = z0(1:nElems);
0068 ierr = close(nc);
0069 
0070 
0071 
0072 <span class="keyword">if</span>(ftbverbose);
0073   fprintf([<span class="string">'end   : '</span> subname <span class="string">'\n'</span>])
0074 <span class="keyword">end</span>;
0075 
0076</pre></div>
<hr><address>Generated on Wed 02-Nov-2011 21:58:00 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" title="Matlab Documentation in HTML">m2html</a></strong> &copy; 2005</address>
</body>
</html>